require 'watir'
include Watir
require 'test/unit'
require 'test/unit/ui/console/testrunner'
require 'watir/testUnitAddons'
require 'watir/testcase'
require 'watir/contrib/enabled_popup'

class TC_Admin < Test::Unit::TestCase
  def test_35
    $ie.goto($UniVar)
    $ie.refresh()
    $ie.refresh()
    
    $ie.link(:text, 'Control Panel').click
    $ie.link(:text, 'Administration').click
    $ie.table(:index, 9).click
    $ie.link(:index, 13).click
    $ie.text_field(:index, 1).value = "anonymous"
    $ie.link(:text, 'Search').click
    $ie.wait()
    $ie.link(:text, 'Anonymous').click
    $ie.wait()
    $ie.link(:text, 'Add/Remove Roles').click
    $ie.frame(:index, 1).select_list(:id, /ctl00_ctl00_bcr_listAvailableRoles/).select('BlogAdministrator')
    $ie.frame(:index, 1).button(:index, 1).click
    $ie.frame(:index, 1).link(:index, 1).click
    $ie.link(:text, 'Sign out').click
    $ie.link(:text, 'Sign in').click
    
    #find out anonymous password
    $ie.text_field(:id, /username/ ).set($ADMIN)
    $ie.text_field(:id, /password/ ).set($PASSWORD)
    $ie.link(:id, /ctl00_bcr_ctl00_ctl03_loginButton/).click         
    assert($ie.link(:text, 'Control Panel').exists?)

  end
end